import Vue from 'vue';
import Vuex from 'vuex';
import {
    SET_LOADING_STATUS,
    SET_LIST_LOADING_STATUS,
    SET_NAVBAR_STATUS,
    SET_TABBAR_STATUS
} from './mutation-types';

import CenterModule from './modules/centerModule'
import CourtModule from './modules/courtModule'
const state = {
    loading: false,
    listLoading: true,
    showNavbar: true,
    showTabbar: false,
    direction: 'forward',
    // showConfirm: false
}

const mutations = {
    SET_LOADING_STATUS(state, isLoading) {
        console.log("show loading:" + isLoading)
        state.loading = isLoading;
    },
    SET_LIST_LOADING_STATUS(state, isLoading) {
        console.log("list loading:" + isLoading)
        state.listLoading = isLoading;
    },
    SET_NAVBAR_STATUS(state, showNavbar) {
        console.log("show navbar:" + showNavbar)
        state.showNavbar = showNavbar;
    },
    SET_TABBAR_STATUS(state, showTabbar) {
        console.log("show tabbar:" + showTabbar)
        state.showTabbar = showTabbar;
    },
    UPDATE_DIRECTION(state, direction) {
        state.direction = direction
    }
}

//配置所有的state mutations 以及 modules
export default new Vuex.Store({
    state,
    mutations,
    modules: {
        CenterModule,
        CourtModule
    }
})
